package com.ktgj.train.service;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.ktgj.pay.api.domain.UnionPayQRCodeResponseApi;
import com.ktgj.train.domain.*;
import com.ktgj.train.domain.InterfaceEntity.*;
import com.ktgj.train.domain.vo.CustomerTrain;
import com.ktgj.train.domain.vo.JourneyTrainOrderVo;
import com.ktgj.train.domain.vo.TrainOrderVo;
import com.ktgj.train.domain.vo.OrderDetailsVo;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletRequest;

/**
 * 订单Service接口
 * 
 * @author ruoyi
 * @date 2021-11-29
 */
public interface ITrainOrderService 
{
    /**
     * 查询订单
     * 
     * @param orderid 订单ID
     * @return 订单
     */
    public TrainOrder selectTrainOrderById(Long orderid);

    /**
     * 查询订单列表
     * 
     * @param trainOrder 订单
     * @return 订单集合
     */
    public List<TrainOrder> selectTrainOrderList(TrainOrder trainOrder);

    /**
     * 新增订单
     * 
     * @param trainOrder 订单
     * @return 结果
     */
    public int insertTrainOrder(TrainOrder trainOrder);

    /**
     * 修改订单
     * 
     * @param trainOrder 订单
     * @return 结果
     */
    public int updateTrainOrder(TrainOrder trainOrder);

    public int updateByTrainOrder(TrainOrderVo trainOrderVo);

    /**
     * 批量删除订单
     * 
     * @param orderids 需要删除的订单ID
     * @return 结果
     */
    public int deleteTrainOrderByIds(Long[] orderids);

    /**
     * 删除订单信息
     * 
     * @param orderid 订单ID
     * @return 结果
     */
    public int deleteTrainOrderById(Long orderid);

    //填写订单
    TrainFillOrder fillOrder(String token, QueryTrainSeatRequest request);

    /**
     * 生成订单
     * @param token 请求头
     * @return
     */
    Order createOrder(String token, GenerateOrder request) throws Exception;

    //订单详情列表
    TrainOrderVo queryOrderDetail(String orderNumber);

    //取消订单
    TrainStayOutTicket cancelOrder(String token, TrCancellationOrderRequest request);

    /**
     * 火车票（退票）
     * */
    public OrderDetailsVo refundApplication(Long orderid);

    /**
     * 订单详情
     * @param token
     * @param orderNumber
     * @return
     */
    public TrainStayOutTicket queryTrainOrder(String token, String orderNumber, Long customerId);

    /**
     * 退票申请
     * @param token
     * @return
     */
    RetreatTicket retreat(String token, Long customerId, String orderNumber);

    /**
     * 请求退票
     * @param token
     * @param request
     * @return
     */
    TrRetreatTicketResponse retreatTicket(String token, TrRetreatTicketRequest request);

    //保存占座回调
    public int updateByCallback(TrainOrder trainOrder);

    public Long selectOrderId(String orderPartnerNumber);

    /**
     * 收银台
     * @param token
     * @param orderNumber
     * @param businessType
     * @return
     */
    public Cashier queryByPayOrder(String token, String orderNumber, String businessType);

    /**
     * 微信小程序支付
     * @param customerId
     * @param openId
     * @param orderNumber
     * @return
     */
    public Map<String, Object> wechatPay(Long customerId, String openId, String orderNumber, BigDecimal amount) throws Exception;

    /**
     * 改签微信小程序支付
     * @param openId
     * @param orderNumber
     * @return
     */
    public Map<String, Object> changeWechatPay(String openId, String orderNumber, BigDecimal amount, String type) throws Exception;

    /**
     * 查询订单
     *
     * @param orderNumber 订单编号
     * @return 订单
     */
    public TrainOrder selectTrainOrderByOrderId(String orderNumber);

    /**
     * 查询会员火车票订单列表
     * */
    public List<TrainOrder> selectTrainOrderNum(Long customerId) throws Exception;

    /**
     * 火车票订单列表
     * */
    public List<TrainOrder> trainOrderList(String startDate, String finishDate);

    /**
     * 火车票订单列表（CRM）
     * @param order
     * @return
     */
    public List<TrainOrderCRM> trainOrder(TrainCRMOrder order);

    /**
     * 火车票二维码
     * */
    public UnionPayQRCodeResponseApi tainCodePay(HttpServletRequest request, String billNo, BigDecimal amount, String type) throws Exception;

    /**
     * 请求改签
     * @param request
     * @return
     */
    public TrainChangeOrder trainRequestChange(TrTicketChangesRequest request);

    /**
     * 取消改签
     * @param orderId
     * @return
     */
    public TrCancelChangeResponse trainCancelChange(String orderId);

    /**
     * 改签支付
     * @param billNo
     * @return
     */
    public UnionPayQRCodeResponseApi trainRequestChangeQRCode(HttpServletRequest servletRequest, String billNo, BigDecimal amount, String type) throws Exception;

    public int queryTrainOrderNumber(Long customerId);

    /**
     * 支付宝支付
     * @param orderNumber
     * @return
     */
    public String aliPay(String orderNumber);

    /**
     * 火车票银行卡支付
     * @param bankCardPay
     * @return
     */
    public String bankCardPay(HttpServletRequest request, TrainBankCardPay bankCardPay) throws Exception;

    /**
     * 改签火车票银行卡支付
     * @param bankCardPay
     * @return
     */
    public String changeBankCardPay(HttpServletRequest request, TrainBankCardPay bankCardPay) throws Exception;

    /**
     * 火车票语音支付
     * @param bankCardPay
     * @return
     */
    public String voice(HttpServletRequest request, TrainBankCardPay bankCardPay) throws Exception;

    /**
     * 订单列表app
     * @param customerId
     * @param status
     * @return
     */
    public List<TrainOrderApp> orderApp(Long customerId, String status);

    /**
     * 行程火车票订单
     * */
    public JourneyTrainOrderVo journeyTrainOrder(Long orderid);

    /**
     * 订单号获取火车票订单信息
     * */
    public TrainOrder orderNum(String orderNum);

    /**
     * 火车票订单号获取会员信息
     * */
    public CustomerTrain customerByTrainNum(String orderNum);

    List<TrainOrder> orderListThings();
}
